#include <QThread>
#include <QUrl>

#include "testfiledownloader.h"
#include "../filedownloader.h"

testFileDownloader::testFileDownloader(QObject *parent) : QObject(parent)
{
    Jcr::FileDownloader* fd = new Jcr::FileDownloader();
    fd->setUrl(QUrl(QString("http://www.ducatichina.cn/Upload/Image/2015-11-23/201511231136380588.jpg")));
    fd->setSaveDir("f:\\");
    fd->setSaveName("ducati");

    QThread* thread = new QThread();
    fd->moveToThread(thread);
    connect(thread, SIGNAL(started()), fd, SLOT(start()));
    connect(fd, SIGNAL(finished()), thread, SLOT(terminate()));
    connect(fd, SIGNAL(finished()), thread, SLOT(deleteLater()));
    connect(fd, SIGNAL(finished()), fd, SLOT(deleteLater()));
    thread->start();
}

